package com.ujiuye.response;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet("/r6")
public class ResponseDemo5 extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //返回的内容类型
        resp.setContentType("text/html;charset=utf-8");
        PrintWriter pw = resp.getWriter();
        pw.print("<table width='600px' height='200px' border='1px solid' cellspacing='0px'>");
        pw.print("<tr><th>姓名</th><th>年龄</th><th>性别</th></tr>");
        pw.print("<tr><td>pgone</td><td>18</td><td>男</td></tr>");
        pw.print("<tr><td>李小璐</td><td>19</td><td>女</td></tr>");
        pw.print("<tr><td>罗志祥</td><td>18</td><td>男</td></tr>");
        pw.print("</table>");
    }
}
